package com.unism.licence.xml;

import java.io.FileInputStream;

import java.io.*;
import java.net.URL;

public class ReadLicenceXmlFile {

	private URL licenceFilePath;

	public ReadLicenceXmlFile(URL licenceFilePath) {
		this.licenceFilePath = licenceFilePath;
	}

	/**
	 * 得到licence文件的输入流
	 * 
	 * @return FileInputStream
	 */
	public FileInputStream getLicenceFileIn() {
		if (licenceFilePath == null) {
			return null;
		}
		File f = new File(licenceFilePath.getFile());
		if (f == null || !(f.exists() && f.isFile())) {
			return null;
		} else {
			try {
				FileInputStream in = new FileInputStream(f);
				return in;
			} catch (Exception e) {
				return null;
			}
		}

	}

	/**
	 * 关闭licence输入流
	 */
	public void closeLicenceFileIn(FileInputStream in) {
		if (in != null) {
			try {
				in.close();
			} catch (Exception e) {
				;
			}
		}
	}
}
